-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(slo): Handle partial indicator url state #167247
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Pinging @elastic/actionable-observability (Team: Actionable Observability) |
@kdelemme I noticed that the Screen.Recording.2023-09-28.at.14.18.41.movIs this expected behaviour? |
|
||
const indicatorType = indicator.type; | ||
switch (indicatorType) { | ||
case 'sli.apm.transactionDuration': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It would be nice to have constants for the different indicator types. But I know we use these strings in many places, so it would require more changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are typed. If you try to use another string, or add a new type in the indicator type definition but forget to handle it here, you'll get a TS error
Indeed, It is expected because the Transaction Name is not selected (or provided by the url state from the APM page). |
@kdelemme Same happens when the Transaction Name is selected. I'll check how the form validation is done. |
I don't have this behaviour... let me investigate further. |
Maybe a race condition, I need to take a closer look at this. But does the indicator form works when not coming from a prefilled url? |
Yes it works, when not coming from a prefilled url. I can file a separate ticket for this issue with clear steps to reproduce and we fix there. I can have a look. Here's the ticket #167630. If I hardcode the |
@mgiota Actually if the index is supposed to be automatically filled by the form, if using the url state to prefill the form breaks this, we should not merge this PR. I'm going to investigate further and implement the fix in this PR |
@mgiota Good find with the bug! I've fixed it fetching the apm index when the form renders.
If you want to see what is contained in the form at any time, I use this in the main slo_edit_form component: <pre>{JSON.stringify(watch('indicator'), null, 2)}</pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm! You can update the description of this ticket and include resolves #167630
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @kdelemme |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
As soon as this backport is merged, I'll be able to backport this PR into 8.10 as well. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
1 similar comment
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
(cherry picked from commit 9d3213e)
resolves #166765
Summary
When the url state was partially provided, the form was set in an invalid state. This PR fixes it by merging default values with the partial provided state for every indicator type.
I've decided to only handle indicator url state, as I think this is the main use case of the feature. But we can easily enhance it with other part of the form state, e.g. objective, budgeting method, etc...
On top of that, I'm fetching the APM index whenever we render the APM indicator forms, in order to make sure we get the correct index set on the form state.